//
//  HMHorizontalGridView.h
//  01-横向网格控件制作
//
//  Created by teacher on 2017/7/24.
//  Copyright © 2017年 teacher. All rights reserved.
//

#import <UIKit/UIKit.h>


/*
 依赖库
 1. 'Masonry', '~> 1.0.2'
 2. 'SDWebImage', '~> 4.0.0'
 
 注意：ATS
 */

@class HMHorizontalGridView;

@protocol HMHorizontalGridViewDataSource <NSObject>

@required

// 提供网格单元的数量
- (NSInteger)numberOfItemsInHorizontalGridView:(HMHorizontalGridView *)horizontalGridView;

// 提供供网格单元图标路径
- (NSURL *)horizontalGridView:(HMHorizontalGridView *)horizontalGridView urlForItemAtIndex:(NSInteger)idx;

// 提供网格单元标题
- (NSString *)horizontalGridView:(HMHorizontalGridView *)horizontalGridView titleForItemAtIndex:(NSInteger)idx;

@end


@protocol HMHorizontalGridViewDelegate <NSObject>

@optional

// 提供行数
- (NSInteger)rowOfPerPageInHorizontalGridView:(HMHorizontalGridView *)horizontalGridView;

// 提供列数
- (NSInteger)columnOfPerPageInHorizontalGridView:(HMHorizontalGridView *)horizontalGridView;

// 用户点击触发
- (void)horizontalGridView:(HMHorizontalGridView *)horizontalGridView didSelectItemAtIndex:(NSInteger)index;

@end

@interface HMHorizontalGridView : UIView

@property (assign, nonatomic)   id<HMHorizontalGridViewDataSource>  dataSource;

@property (assign, nonatomic)   id<HMHorizontalGridViewDelegate>    delegate;

@property (strong, nonatomic)   UIImage                             *placeholderIconImage;


- (void)reloadData;

@end
